<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>话题列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="admin.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../module/inventory/css/admin/index.css" />
<script type="text/javascript" src="../script/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/yahoo-dom-event/yahoo-dom-event.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/dragdrop/dragdrop-min.js" ></script>
<script type="text/javascript" src="../module/inventory/scripts/yui/calendar/calendar-min.js"></script>
<script type="text/javascript" src="../module/inventory/scripts/index.js"></script>
<script src="../script/my_lightbox.js" language="javascript"></script>
<script type="text/javascript">
    $(function(){
        /* 全选 */
         $('.checkall').click(function(){
            var _self = this;
            $('.checkitem').each(function(){
                if (!this.disabled)
                {
                    $(this).attr('checked', _self.checked);
                }
            });
            $('.checkall').attr('checked', this.checked);
        });
        /*话题类型切换*/
        $('#tag_type').bind('change',function(){
        	var type_val = $(this).val();
            if(type_val=="1"){
                $('#type_brand').hide();
                $('#type_product').hide();
            }
        	if(type_val=="2"){
        		$('#type_brand').show();
        		$('#type_product').hide();
        	}
            if(type_val=="3"){
                $('#type_product').show();
                $('#type_brand').hide();
            }
        });
        /*贴纸选择*/
        $('#paster_name').bind('input click',function(){
        	var paster_name = $(this).val();
        	$.post('<{$config.weburl}>/admin/module.php?m=sns&s=sns_paster.php',{act:"ajax_get_paster",name:paster_name},function(data){
        		if(data){
        			if(!$('#ajax_paster').length)
       				{
        				$('#paster_name').after("<div id='ajax_paster' style='position:absolute;top:200px;width:206px;max-height:400px;overflow-y:auto;'></div>");
       				}
        			$('#ajax_paster').html(data);
        			$('#ajax_paster').show();
        		}
        	});
        });
    });
    function choose_paster(paster_id,paster_name){
        $("#paster_id").val(paster_id);
        $("#paster_name").val(paster_name);
    }
</script>
<style>
#ajax_paster {
    border: 1px solid #999;
}
#ajax_paster {
    position: absolute;
    background: #FFF;
    line-height: 160%;
}
#ajax_paster a.menuas {
    display: block;
    text-decoration: none;
    padding: 3px 4px 1px 4px;
}
#ajax_paster a:hover{
	background:#999;
}
</style>
</head>
<body>
<div class="container">
	<{if $smarty.get.act=='edit'}>
			<div class="flow">
	        <div class="itemtitle">
	            <h3>编辑</h3>
	            <ul>
                    <li><a href="?m=sns&s=sns_tags.php"><span>话题列表</span></a></li>
                </ul>
	        </div>
	    </div>
	    
		<form name="form" id="form" method="post">
            <input name="id" type="hidden" value="<{$de.id}>">
            <table class="table">
                <thead>
                    <tr>
                        <th class="partition" colspan="99">话题</th>
                    </tr>
                </thead>
                <tbody>
                <tr>
                    <td width="100">话题标签名</td>
                    <td>
                    <input name="oldtagname" type="hidden" value="<{$de.tagname}>">
                    <input name="tagname" id="tagname" type="text" class="w200" value="<{$de.tagname}>"><{if $smarty.get.tagname_error}><span class="warning">已存在该话题名</span><{/if}>
                    </td>
                </tr>
                
                <tr>
                  <td width="100">话题图片</td>
                  <td><input class="text w200" type="text" name="logo" id="tag_pic" value="<{$de.logo}>" />[<a href="javascript:uploadfile('上传贴纸','tag_pic',0,0,'sns/tag_pic')">上传</a>] 
                    [<a href="javascript:preview('tag_pic');">预览</a>]
                    [<a onclick="javascript:$('#tag_pic').val('');" href="#">删除</a>] </td>
                </tr>
                
                <tr>
                    <td width="100">话题类型</td>
                    <td>
                        <select name="tag_type" id="tag_type">
                            <option value="1">普通话题</option>
                            <option value="2" <{if $de.brandid>0 || $smarty.get.tag_type=='2'}>selected<{/if}>>品牌话题</option>
                            <option value="3" <{if $de.productid>0 || $smarty.get.tag_type=='3'}>selected<{/if}>>单品话题</option>
                        </select>
                    </td>
                </tr>
          
                <tr <{if !$de.brandid>0 && $smarty.get.tag_type!='2'}>style="display:none;"<{/if}> id="type_brand">
                    <td>关联品牌</td>
                    <td>
                    <input type="hidden" name="brandid" class="brandid" value="<{$de.brandid}>"/>
                    <input type='text' name='brand' class='brands' value="<{$de.brand}>" placeholder='输入搜索词' autocomplete="off"/><{if $smarty.get.brandid_error}><span class="warning">您选择的品牌已被绑定</span><{/if}>
            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 139px;">
        			</ul>
            		   
                    </td>
                </tr>
                
                <tr <{if !$de.productid>0 && $smarty.get.tag_type!='3'}>style="display:none;"<{/if}> id="type_product">
                    <td>关联商品</td>
                    <td>
                        <input type="text" name="productid" id="productid" value="<{$de.productid}>"/><{if $smarty.get.productid_error}><span class="warning">您输入的产品ID不存在</span><{/if}>
                    </td>
                </tr>
                
                <tr>
                    <td>绑定贴纸</td>
                    <td>
	                    <input type="hidden" name="paster_id" id="paster_id" value="<{$de.paster_id}>"/>
	                    <input type='text' name='paster_name' id='paster_name' value='<{$de.paster_name}>' placeholder='输入贴纸名称' autocomplete="off"/><{if $smarty.get.pasterid_error}><span class="warning">您选择的贴纸已绑定其他话题，请重新选择</span><{/if}>
                    </td>
                </tr>
                
                <tr>
                    <td>话题描述</td>
                    <td>
                        <textarea style="width:200px; height:50px" name="description"><{$de.description}></textarea>
                    </td>
				</tr>
                <tr>
                    <td>话题展示图组</td>
                    <td><input type="text" name="tag_pics" class="w200" value="<{$de.pic}>"><span style="color:red;">(请输入三个分享ID，用英文逗号隔开，少于或多于三个则不保存此字段)</span></td>
                </tr>
                
                <tr>
                    <td>展示状态</td>
                    <td>
                    <input type="radio" name="status" value="1" id="open" <{if $de.status==1}>checked="checked"<{/if}>/><label for="open">显示</label>
                    <input type="radio" name="status" value="0" id="forbid" <{if $de.status==0}>checked="checked"<{/if}>/><label for="open">禁用</label>
                    <input type="radio" name="status" value="-1" id="close" <{if $de.status==-1}>checked="checked"<{/if}>/><label for="close">删除</label>
                    </td>
                </tr>
                
                <tr>
                    <td>&nbsp;</td>
                    <td>
                    <input class="submit" type="submit" value="提交">
                    <input name="act" type="hidden" id="action" value="save">
                    </td>
                </tr>
                </tbody>
            </table>
            </form>
	<{elseif $smarty.get.act=='getFavoriteMember'}>
		<div class="flow">
	        <div class="itemtitle">
	            <h3>关注此话题的会员列表</h3>
	            <ul>
                    <li><a href="?m=sns&s=sns_tags.php"><span>话题列表</span></a></li>
                </ul>
	        </div>
	    </div>
	    
	    <div class="h35"></div>

	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="50">用户ID</th>
	                <th width="100">用户名称</th>
	                <th width="100">用户头像</th>
	                <th width="50">性别</th>
	                <th width="100">手机</th>
	                <th width="100">邮箱</th>
	                <th width="50">注册时间</th>
	            </tr>
	            <{foreach item=list from=$de.favoriteMembers}>
	            <tr>
	                <td><{$list.userid}></td>
	                <td><{$list.username}></td>
	                <td width="80">
	                	<img width="60" height="60" class="img" src="<{$list.logo}>" />
	                </td>
	                <td><{if '1'==$list.sex}>男<{else}>女<{/if}></td>
	                <td><{$list.mobile}></td>
	                <td><{$list.email}></td>
	                <td><{$list.regtime}></td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99"><div class="page"><{$de.page}></div><{if $countpro}>共有<{$countpro}>条记录<{/if}></td>
	            </tr>
	        </tfoot>
	    </table>
	<{elseif $smarty.get.act=='show_sns_list'}>
		<div class="flow">
	        <div class="itemtitle">
	            <h3>分享列表</h3>
	            <ul>
                    <li><a href="?m=sns&s=sns_tags.php"><span>话题列表</span></a></li>
                </ul>
	        </div>
	    </div>
	    
	    <div class="h35"></div>
	    
	    <form action="" method="get">
	    <input type="hidden" name="m" value="sns">
	    <input type="hidden" name="s" value="sns_tags.php">
	    <input type="hidden" name="act" value="show_sns_list">
	    <input type="hidden" name="tagname" value="<{$smarty.get.tagname}>">
	    <table class="select_table">
	        <tbody>
	            <tr>
	                <td width="60">分享时间:</td>
	                <td class="yui-skin-sam" width="150">
	                	<input style="width:70px;" id="sdate" name="sdate" type="text" size="12" value="<{$smarty.get.sdate}>" onfocus="lockinput(this)" />
	                	<input style="width:70px;" id="edate" name="edate" type="text" size="12" value="<{$smarty.get.edate}>" onfocus="lockinput(this)" />
	            		<div id="calContainer" style="display:none; position:absolute;"></div>
            		</td>
	                <td width="60">会员名称:</td>
	                <td width="100"><input id="username" type="text" name="username" class="w100" value="<{$smarty.get.username}>" /></td>
	                <td width="20">品牌:</td>
	                <td width="100">
	                	<input type="hidden" name="brandid" class="brandid" value="<{$smarty.get.brandid}>"/>
	                	<input style="width:150px;" type='text' name='brand' class='brands' value="<{$smarty.get.brand}>" placeholder='输入搜索词' autocomplete="off"/>
	            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;">
	        			</ul>
	                </td>
                </tr>
                <tr>
	                <td width="60">点赞数排序:</td>
	                <td width="60">
	                	<select name="fnumsort">
	                		<option value="">默认排序</option>
	                		<option value="desc" <{if 'desc'==$smarty.get.fnumsort}>selected<{/if}>>由高到低</option>
	                		<option value="asc" <{if 'asc'==$smarty.get.fnumsort}>selected<{/if}>>由低到高</option>
	                	</select>
	                </td>
	                <td width="20">状态:</td>
	                <td width="30">
	                	<select name="status">
	                		<option value="">全部</option>
	                		<option value="-1" <{if '-1'==$smarty.get.status}>selected<{/if}>>已删除</option>
	                		<option value="0" <{if '0'==$smarty.get.status}>selected<{/if}>>已禁用</option>
	                		<option value="1" <{if '1'==$smarty.get.status}>selected<{/if}>>正常显示</option>
	                		<option value="2" <{if '2'==$smarty.get.status}>selected<{/if}>>推荐显示</option>
	                	</select>
	                </td>
	                
	                <td><input type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
	            </tr>
	            
	        </tbody>
	    </table>
	    </form>
	
	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="50">分享ID</th>
	                <th width="100">分享图片</th>
	                <th width="100">分享标题</th>
	                <th width="100">标签</th>
	                <th width="100">品牌</th>
	                <th width="150">会员信息</th>
	                <th width="50">点赞数</th>
	                <th width="50">分享时间</th>
	                <th width="100">状态</th>
	            </tr>
	            <{foreach item=list from=$de.list}>
	            <tr>
	                <td><{$list.id}></td>
	                <td><img class="img" src="<{$img_url_pre}><{$list.pic}>/80" width="80" /></td>
	                <td><{$list.title}></td>
	                <td><{$list.tagname}></td>
	                <td><{$list.brand}></td>
	                <td width="80">
	                	<img width="40" height="40" class="img" src="<{$list.member_photo}>" />
						<span>
							<p>会员ID：<{$list.member_id}></p>
		                	<p>会员名称：<{if ''==$list.member_name}>暂无<{else}><{$list.member_name}><{/if}></p>
						</span>
	                </td>
	                <td><{$list.favoriteNum}></td>
	                <td><{$list.create_time}></td>
	                <td>
	                <{if '-1'==$list.status}>已删除<{/if}>
	                <{if '0'==$list.status}>违规禁用<{/if}>
	                <{if '1'==$list.status}>正常显示<{/if}>
	                <{if '2'==$list.status}>推荐显示<{/if}>
	                </td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99">
	                	<div class="page"><{$de.page}><{if $countpro}>共有<{$countpro}>条记录<{/if}></div>
	                </td>
	            </tr>
	        </tfoot>
	    </table>
	<{else}>
	    <div class="flow">
	        <div class="itemtitle">
	            <h3>话题列表</h3>
	        </div>
	    </div>
	    
	    <div class="h35"></div>
	    
	    <form action="" method="get">
	    <input type="hidden" name="m" value="sns">
	    <input type="hidden" name="s" value="sns_tags.php">
	    <table class="select_table">
	        <tbody>
	            <tr>
	                <td width="60">发布时间:</td>
	                <td class="yui-skin-sam" width="150">
	                	<input style="width:70px;" id="sdate" name="sdate" type="text" size="12" value="<{$smarty.get.sdate}>" onfocus="lockinput(this)" />
	                	<input style="width:70px;" id="edate" name="edate" type="text" size="12" value="<{$smarty.get.edate}>" onfocus="lockinput(this)" />
	            		<div id="calContainer" style="display:none; position:absolute;"></div>
            		</td>
	                <td width="50">发布人:</td>
	                <td width="100"><input id="username" type="text" name="username" class="w100" value="<{$smarty.get.username}>" /></td>
	                <td width="50">标签:</td>
	                <td width="100"><input id="tagname" type="text" name="tagname" class="w100" value="<{$smarty.get.tagname}>" /></td>
	                <input type="hidden" id="order" name="" value="" />
                    <td width="20"><input id="search" type="image" src="<{$config.weburl}>/image/admin/search.gif" /></td>
                </tr>
                <tr>
                	<td width="20">品牌:</td>
	                <td width="100">
	                	<input type="hidden" name="brandid" class="brandid" value="<{$smarty.get.brandid}>"/>
	                	<input style="width:150px;" type='text' name='brand' class='brands' value="<{$smarty.get.brand}>" placeholder='输入搜索词' autocomplete="off"/>
	            		<ul class="brandlist" style="display:none;position:absolute;background-color:#fff;border: 1px solid rgb(207, 201, 201);width: 150px;">
	        			</ul>
	                </td>
	                <td width="100">贴纸名称:</td>
                    <td width="100"><input id="pasterName" type="text" name="pasterName" class="w100" value="<{$smarty.get.pasterName}>" /></td>
	                <td width="20">状态:</td>
	                <td width="30">
	                	<select name="status">
	                		<option value="">全部</option>
	                		<option value="-1" <{if '-1'==$smarty.get.status}>selected<{/if}>>已删除</option>
	                		<option value="0" <{if '0'==$smarty.get.status}>selected<{/if}>>已禁用</option>
	                		<option value="1" <{if '1'==$smarty.get.status}>selected<{/if}>>正常显示</option>
	                	</select>
	                </td>
                </tr>
                <tr>
                   <td width="20">是否有描述:</td>
                   <td width="30">
                        <select name="is_desc">
                            <option value="">全部</option>
                            <option value="0" <{if '0'==$smarty.get.is_desc}>selected<{/if}>>无描述</option>
                            <option value="1" <{if '1'==$smarty.get.is_desc}>selected<{/if}>>有描述</option>
                        </select>
                    </td>
	                <td width="20">是否指定图组:</td>
	                <td width="30">
	                	<select name="is_pics">
	                		<option value="">全部</option>
	                		<option value="0" <{if '0'==$smarty.get.is_pics}>selected<{/if}>>无图组</option>
	                		<option value="1" <{if '1'==$smarty.get.is_pics}>selected<{/if}>>有图组</option>
	                	</select>
	                </td>
	                <td width="20">话题类型:</td>
	                <td width="30">
	                	<select name="tagType">
	                		<option value="">全部</option>
	                		<option value="0" <{if '0'==$smarty.get.tagType}>selected<{/if}>>普通话题</option>
	                		<option value="1" <{if '1'==$smarty.get.tagType}>selected<{/if}>>商品话题</option>
	                		<option value="2" <{if '2'==$smarty.get.tagType}>selected<{/if}>>已绑定品牌话题</option>
	                		<option value="3" <{if '3'==$smarty.get.tagType}>selected<{/if}>>未绑定品牌话题</option>
	                	</select>
	                </td>
	            </tr>
	            
	        </tbody>
	    </table>
	    </form>
	
		<form action="" name="snsform" method="get">
		<input type="hidden" name="m" value="sns">
	    <input type="hidden" name="s" value="sns_tags.php">
	    <table class="table product">
	        <tbody>
	            <tr class="header">
	                <th width="20"><input type="checkbox" class="checkall" ></th>
	                <th width="50">话题ID</th>
	                <th width="100">话题标签</th>
	                <th width="100">话题图片</th>
	                <th width="100">话题描述</th>
	                <th width="100">话题图组ID</th>
	                <th width="100">品牌</th>
	                <th width="50">商品ID</th>
	                <th width="100">贴纸</th>
	                <th width="50"><a href="javascript:doorder('order','<{if $smarty.get.order==desc}>asc<{else}>desc<{/if}>');">关注数</a></th>
	                <th width="100">发布人</th>
	                <th width="50"><a href="javascript:doorder('timeorder','<{if $smarty.get.timeorder==desc}>asc<{else}>desc<{/if}>');">发布时间</a></th>
	                <th width="100">状态</th>
	                <th width="100">操作</th>
	            </tr>
	            <{foreach item=list from=$de.list}>
	            <tr>
	                <td><input type="checkbox" value="<{$list.id}>" class="checkitem" name="chk[]"></td>
	                <td><{$list.id}></td>
	                <td><{$list.tagname}></td>
	                <td><img src="<{$list.logo}>" width="80"/></td>
	                <td><{$list.description}></td>
	                <td><{$list.pic}></td>
	                <td><{$list.brand}></td>
	                <td><{if $list.productid!=0}><{$list.productid}><{/if}></td>
	                <td width="80"><{if $list.paster_pic}><img src="<{$list.paster_pic}>" width="50" height="50"><{/if}></td>
	                <td><{if $list.tag_favorite_count>0}><a style="color:blue;text-decoration:underline;" href="?m=sns&s=sns_tags.php&act=getFavoriteMember&tag_id=<{$list.id}>"><{$list.tag_favorite_count}></a><{else}>0<{/if}></td>
	                <td><{$list.create_user}></td>
	                <td><{$list.create_time}></td>
	                <td>
	                <{if '-1'==$list.status}>已删除<{/if}>
	                <{if '0'==$list.status}>已禁用<{/if}>
	                <{if '0'<$list.status}>正常显示<{/if}>
	                </td>
	                <td><a href="?m=sns&s=sns_tags.php&act=edit&editid=<{$list.id}>&<{$edit_url}>"><input type='button' value='编辑'></a> <a href="?m=sns&s=sns_tags.php&act=show_sns_list&tag_id=<{$list.id}>&tagname=<{$list.tagname}>"><input type='button' value='查看分享'></a></td>
	            </tr>
	            <{foreachelse}>
	            <tr>
	                <td class="norecord" colspan="99"><i></i><span>暂无符合条件的数据记录</span></td>
	            </tr>
	            <{/foreach}>
	        </tbody>
	        <tfoot>
	            <tr>
	                <td colspan="99">
	                	状态设置:
	                	<select name="set_status">
	                		<option value="">--请选择--</option>
	                		<option value="-1" >删除</option>
	                		<option value="0" >禁用</option>
	                		<option value="1" >正常</option>
	                	</select>
		                <input type="hidden" name="act" value="op" />
	                    <input type="submit" value="提交" />
	                	<div class="page"><span style="float:left;line-height: 20px;"><{if $countpro}>共有<{$countpro}>条记录<{/if}></span><{$de.page}></div>
	                </td>
	            </tr>
	        </tfoot>
	    </table>
    </form>
    <{/if}>
</div> 
</body>
<script>
//排序
function doorder(key,value){
	var order = $('#order');
	order.attr('name',key);
	order.attr('value',value);
	
	$('#search').trigger('click');
}
$(function(){
	//默认待选品牌
	$('.brands').bind('click',function(e){
			$.get("<{$config.weburl}>/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname=",function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
	});
	//直接搜品牌
	$('.brands').bind('input',function(e){
		var value=$(this).val();
		if(value==''){
			$('.brandlist').hide();
			return ;
		}
		else{
			$.get("<{$config.weburl}>/admin/module.php?m=activity&s=activity.php&operation=getbrand&brandname="+value,function(data){
				$('.brandlist').show();
				$('.brandlist').html(""+data);
			});
		}
	});
	$('body').bind('click',function(e){
		$('.brandlist').hide();
		$('#ajax_paster').hide();
	});
	$('.brandlist').delegate('li','click',function(){
		var _this=$(this);
		var brandName=_this.text();
			var brandId=_this.attr('bid');
			$('.brands').val(brandName);
			$('.brandid').val(brandId);
			$('.brandlist').hide();
	});
});
</script>
</html>